<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right" style="font-size: 16px;">
      <el-breadcrumb-item :to="{ path: '/' }">后台管理</el-breadcrumb-item>
      <el-breadcrumb-item>首页</el-breadcrumb-item>
    </el-breadcrumb>

    <el-divider></el-divider>

    <el-button style="width: 350px;height: 350px;font-size: 30px " type="info"  icon="el-icon-user-solid" @click="User()">当前用户数<br>{{countUser}}</el-button>
    <el-button style="width: 350px;height: 350px;font-size: 30px " type="info"  icon="el-icon-s-goods" @click="goods()">商品上架数量<br>{{countGoods}}</el-button>
    <el-button style="width: 350px;height: 350px;font-size: 30px " type="info"  icon="el-icon-s-order" @click="order()" >未处理订单<br>{{countOrder}}</el-button>

  </div>
</template>
<script>
export default {
  data() {
    return {
      countGoods:"0",
      countUser:"0",
      countOrder:'0'
    };
  },
  methods:{
    goods(){
      this.$router.push('goodslist');
    } ,User(){
      this.$router.push('adminuser');
    },order(){
      this.$router.push('orders3');
    },
    selectCount(){
      let url='http://localhost:8080/adminGoodsAddNew/selectGoodsCount';
      this.axios.get(url).then((response)=> {
        let responseBody=response.data;
        if(responseBody.state==20000){
          this.countGoods=responseBody.data;
        }
      })
    },
    selectUserCount(){
      let url='http://localhost:8080/adminuser/selectGoodsCount';
      this.axios.get(url).then((response)=> {
        let responseBody=response.data;
        if(responseBody.state==20000){
          this.countUser=responseBody.data;
        }
      })
    },
    selectOrderCount(){
      let url='http://localhost:8080/adminorders/selectOrderCount';
      this.axios.get(url).then((response)=> {
        let responseBody=response.data;
        if(responseBody.state==20000){
          this.countOrder=responseBody.data;
        }
      })
    }
  },
  mounted() {
    this.selectCount();
    this.selectUserCount();
    this.selectOrderCount();
  }
};
</script>